<?php
/**
 * 工具类，加密解密
 * Created by PhpStorm.
 * User: wzy
 * Date: 2017/6/14
 * Time: 13:51
 */
namespace soa\tools;

use soa\client;
use artisan\cache;

class EnOrDeCrypt extends client
{
    /**
     * 加密
     * @param $str
     * @return string
     */
    public function encrypt($str){
        if(empty($str))
            return  "";
        $key = substr(md5('kuaidihelp'),0,16);
        $ivkey = substr(md5('kuaidihelp'),16,16);
        return \artisan\aes::encrypt($str,$key,$ivkey);
    }

    /**
     * 解密
     * @param $str
     * @return string
     */
    public function decrypt($str){
        if(empty($str))
            return  "";
        $key = substr(md5('kuaidihelp'),0,16);
        $ivkey = substr(md5('kuaidihelp'),16,16);
        return \artisan\aes::decrypt($str,$key,$ivkey);
    }


}